package com.example.shop.goods.dto;

import com.example.shop.pojo.GoodsClass;
import lombok.Data;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

@Data
public class GoodsStyleParam {
    //款式图片
    @NotNull
    private MultipartFile classPicture;
    //该型号名
    @NotEmpty
    private String goodsClass;
    //该型号的价格
    @NotNull
    private Integer classPrice;
    //该型好的库存量
    @NotNull
    private Integer classInventory;

    public GoodsClass toGoodsClass(){
        GoodsClass goodsClass = new GoodsClass();
        goodsClass.setGoodsClass(this.goodsClass);
        goodsClass.setClassPrice(classPrice);
        goodsClass.setClassInventory(classInventory);
        return goodsClass;
    }

    public GoodsStyle toGoodsStyle(){
        GoodsStyle goodsStyle = new GoodsStyle();
        goodsStyle.setGoodsClass(this.goodsClass);
        goodsStyle.setClassPrice(classPrice);
        goodsStyle.setClassInventory(classInventory);
        return goodsStyle;
    }
}
